package com.conan.spring5.dao.proxy;

import com.conan.spring5.dao.UserDAO;
import com.conan.spring5.dao.impl.UserDAOImpl;

import java.lang.reflect.Proxy;

/**
 * @version 加油！！！
 * @Description
 * @Author 谷藤新一GYC
 * @Date 2022/10/21 - 19:58
 */
public class JDKProxy {
    public static void main(String[] args) {
        UserDAOImpl userDAO = new UserDAOImpl();
        Class[] interfaces = {UserDAO.class};
        UserDAO dao = (UserDAO) Proxy.newProxyInstance(JDKProxy.class.getClassLoader(), interfaces, new UserDAOProxy(userDAO));
        Integer result = dao.add(1, 2);
        System.out.println(result);
    }
}
   